<template>
  <div class="user_date">
    <div class="user_box">
      <div class="user_date_form">
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="会员名">
            <el-input v-model="form.name"></el-input>
          </el-form-item>
          <el-form-item label="登录邮箱">
            <el-input v-model="form.email"></el-input>
          </el-form-item>
          <el-form-item label="绑定手机">
            <el-input v-model="form.phone"></el-input>
          </el-form-item>
          <el-form-item label="当前头像">
            <el-upload
              action="https://jsonplaceholder.typicode.com/posts/"
              name="file"
              list-type="picture-card"
              :on-preview="handlePictureCardPreview"
              :on-remove="handleRemove"
              :on-success="onSuccess"
            >
              <i class="el-icon-plus"></i>
            </el-upload>
            <el-dialog :visible.sync="dialogVisible">
              <img width="100%" :src="dialogImageUrl" alt="" />
            </el-dialog>
          </el-form-item>

          <el-form-item label="性别">
            <el-radio-group v-model="form.resource">
              <el-radio label="男"></el-radio>
              <el-radio label="女"></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="地区">
            <el-input v-model="form.region"></el-input>
          </el-form-item>

          <el-form-item label="个人介绍">
            <el-input type="textarea" v-model="form.desc"></el-input>
          </el-form-item>
          <el-form-item>  
            <el-button type="primary" @click="onSubmit">保存</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        name: "xb36998693",
        email: "3966555@qq.com",
        phone: "19393561786",
        resource: " ",
        desc: "",
        region: "",
        dialogImageUrl: "",
        dialogVisible: false,
      },
    };
  },
  created() {
    console.log(JSON.stringify(this.form));
  },
  methods: {
    onSuccess(response, file, fileList) {


    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },

    onSubmit() {
      var data = this.form;
      var dataJSON = JSON.stringify(data);
    },
  },
};
</script>


<style scoped>
.el-input__inner {
  height: 30px;
  line-height: 40px;
}

.el-form-item {
  margin-bottom: 10px;
}

.user_date_form {
  width: 390px;
  height: auto;
  padding-top: 36px;
  margin-left: 10%;
}

.user_box {
  width: 960px;
  height: 680px;
  margin: 10px 26px;
  background-color: white;
}
</style>